package com.icxcc.icxwebflux.config;

import com.icxcc.icxwebflux.handler.TestHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.ServerResponse;

import static org.springframework.web.reactive.function.server.RouterFunctions.route;
import static org.springframework.web.reactive.function.server.RequestPredicates.GET;
@Configuration
public class TestConfig {
    @Autowired
    private TestHandler testHandler;

    @Bean
    public RouterFunction<ServerResponse> testRouter(){
        return route(GET("/test"), testHandler::getTest)
                .andRoute(GET("/time"),testHandler::getTime);
    }


}
